package com.fire.component.extension;

public enum BizCommonError implements CommonError {
    //通用错误类型10001
    PARAMETER_VALIDATION_ERROR("10001","参数不合法"),
    UNKNOWN_ERROR("10002","未知错误"),
    //20000开头为用户信息相关错误定义
    USER_NOT_EXIST("20001","用户不存在"),
    USER_LOGIN_FAIL("20002","用户手机号或密码不正确"),
    USER_NOT_LOGIN("20003","用户还未登陆"),
    USER_LOGIN_ANYWHERE("20003","用户在其它地方登陆"),
    //30000开头为交易信息错误定义
    STOCK_NOT_ENOUGH("30001","库存不足"),
    MQ_SEND_ERROR("30001","消息投递失败"),
    RATE_LIMIT("30003","活动太火爆，请稍后在尝试"),

    //40000开头锁错误定义
    GET_LOCK_FAILED("40001", "获取锁异常"),
    UNLOCK_FAILED("40002", "释放锁失败")
    ;

    BizCommonError(String errCode, String errMsg){
        this.errCode = errCode;
        this.errMsg = errMsg;
    }


    private String errCode;
    private String errMsg;


    @Override
    public String getErrCode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
